import request from '@/utils/request'
import type { ClazzModel, SearchClazzModel, ResultModel, PageModel } from './model/model'

// 分页+条件查询班级
export const getClazzListApi = (params: SearchClazzModel & { page: number; pageSize: number }) =>
  request.get<ResultModel<PageModel>>('/clazzs', { params })

// 添加班级
export const addClazzApi = (clazz: ClazzModel) => request.post<ResultModel>('/clazzs', clazz)

// 根据ID查询班级
export const getClazzByIdApi = (id: number) => request.get<ResultModel<ClazzModel>>(`/clazzs/${id}`)

// 修改班级
export const updateClazzApi = (clazz: ClazzModel) => request.put<ResultModel>('/clazzs', clazz)

// 删除班级
export const deleteClazzApi = (id: number) => request.delete<ResultModel>(`/clazzs/${id}`)
